<template>
  <van-cell
    class="article-item"
    :to="{
      name: 'article',
      params: {
        articleId: articles.id
      }
    }"
  >
    <div slot="title" class="artTitle van-multi-ellipsis--l2">
      {{ articles.title }}
    </div>
    <div slot="label">
      <div v-if="articles.cover.type === 3" class="cover-wrap">
        <div
          v-for="(img, index) in articles.cover.list"
          :key="index"
          class="cover-warp-item"
        >
          <van-image class="cover-img" fit="cover" :src="img" />
        </div>
      </div>
      <div class="lable-warp">
        <span>{{ articles.username }}</span>
        <span>{{ articles.commentcount }}条评论</span>
        <span>{{ articles.time | relativeTime }}</span>
      </div>
    </div>

    <van-image
      class="one-cover"
      v-if="articles.cover.type === 1"
      fit="cover"
      :src="articles.cover.list[0]"
    />
  </van-cell>
</template>
<script>
export default {
  name: 'artItem',
  data () {
    return {}
  },
  created () {},
  methods: {},
  components: {},
  props: {
    articles: {
      type: Object,
      required: true
    }
  },
  watch: {},
  computed: {},
  mounted () {}
}
</script>

<style lang="less" scoped>
.article-item {
  /deep/.van-cell__value {
    flex: unset;
    width: 116px;
    height: 73px;
    margin-left: 5px;
  }
  .one-cover {
    width: 116px;
    height: 73px;
  }
  .cover-wrap {
    display: flex;
    padding: 15px 0;
    .cover-warp-item {
      flex: 1;
      height: 73px;
      &:not(:last-child) {
        padding: 0 5px 0 0;
      }
      .cover-img {
        width: 100%;
        height: 73px;
      }
    }
  }
  .lable-warp {
    font-size: 11px;
  }
  .lable-warp span {
    padding-right: 12px;
  }
  .van-cell__title {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
}
</style>
